Field of the Invention
The present invention is directed in general to data communications. In one aspect, the present invention relates to flow control of data communications.
Description of the Related Art
In data processing systems, data communicated from a source node to a destination node should be received accurately. However, at both the transmitter and receiver sides of a computer network, large amounts of data being transferred can overwhelm transmitter and/or receiver buffers. For example, a transmitting device which captures and transmits image data may include a variable length encoder (VLE) which encodes video data into encoded data for storage in a transmit buffer where it is held for subsequent retrieval and transmission in packets over an Ethernet network. Requiring immediate processing and transmission/reception of the encoded data by a data processing resource to alleviate the possibility of a buffer overflow would typically place an undesirable burden on the central processing unit (CPU) or other processing module of the device. Similarly, it can be costly to provide a memory FIFO at the Data Link layer that is sufficiently large to guarantee not losing encoded/transmitted data before it can be transmitted/offloaded to an application. While processing memory costs can be reduced by using a small memory FIFO to quickly store a small amount of received data temporarily prior to sending the received data to a data buffer, the write and read operations by the VLE Encoder and the software, respectively, should work in a “synchronized” manner so that encoded/received data is read by the software in time and the transmit/receive buffer does not overflow or result in data being overwritten. When the transmit buffer is embodied as a circular or ring buffer, buffer management of the encoded data becomes a major concern, especially when the transmitting device does not know much encoded data is being stored and/or when the amount of data being encoded exceeds the size of the transmit buffer, thereby leading to a possibility of data overflow and loss of encoded data at the transmitting device. A similar problem can occur at a receive buffer when the network receiving device does not have advance knowledge of how large a packet being received will be, let alone how large a next packet will be, thereby leading to a possibility of data overflow and loss of transmitted data at the receiving device. As a result, the existing solutions for efficiently controlling data communication flow are extremely difficult at a practical level.